<template>
	<!-- 公建芯造绑定列表 -->
	<view>
		<TopNavCustom title="公建芯造"></TopNavCustom>
		<view class="container" v-if="nodeList.length != 0">
			<view class="card">
				<u-cell-group v-for="(node, index) in nodeList" :key="index">
					<u-cell size="large" :iconStyle="iconStyle" :title="node.partName" :icon="node._src"
						@click="goto(node)" isLink>
					</u-cell>
				</u-cell-group>
			</view>
		</view>
	</view>
</template>
<script>
	import _utils from "@/common/_utils.js";
	import _public from '@/common/public.js'
	import _constant from "@/common/constant.js"
	export default {
		created() {
			this.getNode();
		},
		data() {
			return {
				iconStyle: {
					width: "40rpx",
					height: "40rpx",
				},
				nodeList: [],
				_title: "",
				estatedId: "",
				_url: "",
			};
		},
		onLoad(para) {
			this._title = para.title;
			this._url = "/pages/ihome/public_building_PM/public_building_PM";
		},
		methods: {
			//获取 estateId 对应绑定的node
			async getNode() {
				let id = await _constant.getConstentPartId('公建芯造')
				const data = await _public.getSelectNode(id)
				if (data.length != 0) {
					this.nodeList = _utils.backNodeArray(data);
				}
			},
			goto(node) {
				let _node = node;
				_node.estateId = uni.getStorageSync("estateId");
				_node._title = this._title;
				_node.flag = true;
				let item = encodeURIComponent(JSON.stringify(_node));
				uni.navigateTo({
					url: this._url + "?item=" + item,
				});
			},
		},
	};
</script>

<style lang="scss" scoped>
	.container {
		padding: 20rpx 30rpx 0 30rpx;

		.card {
			border: 1rpx solid #efefef;
			background: #ffffff;
			border-radius: 20rpx;
		}
	}
</style>
